package hxg.stream.characterStream;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author HeXiangGuang
 * @create 2021-06-28 22:54
 * 字符输出流，写入文件案例
 */
public class Demo3 {
    public static void main(String[] args) throws IOException {
        //1创建对象
        FileWriter fw = new FileWriter("d:\\writer.txt");
        //2写入
        for (int i = 0; i < 10; i++) {
            fw.write("Java是世界上最好的语言！\n");
            fw.flush();//刷新，把数据从临时内存通道刷取到存储中
        }
        //3关闭
        fw.close();
    }
}
